#pragma once

namespace utility {
template <class T>
class SmartPtr {
public:
    SmartPtr() : _data(nullptr) {}
    SmartPtr(T* data) : _data(data) {}
    ~SmartPtr() {
        if (_data != nullptr) {
            delete _data;
            _data = nullptr;
        }
    }

    T* operator->() { return _data; }
    T& operator*() { return *_data; }

private:
    T* _data;
};
};  // namespace utility